home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #5 / Amiga Plus CD - 2000 - No. 5.iso / Tools / Dev / fpc / source / docs / refex / ex40.pp < prev    next >
Encoding:
Text File  |  2000-01-01  |  493 b   |  23 lines

  1. Program Example40;
  2.  
  3. { Program to demonstrate the MaxAvail function. }
  4.  
  5. Var
  6.   P : Pointer;
  7.   I : longint;
  8.   
  9. begin
  10.   { This will allocate memory until there is no more memory}
  11.   I:=0;
  12.   While MaxAvail>=1000 do
  13.     begin
  14.     Inc (I);
  15.     GetMem (P,1000);
  16.     end;
  17.   { Default 4MB heap is allocated, so 4000 blocks 
  18.     should be allocated. 
  19.     When compiled with the -Ch10000 switch, the program
  20.     will be able to allocate 10 block }
  21.   Writeln ('Allocated ',i,' blocks of 1000 bytes'); 
  22. end.
  23.